gdk: Tweak our GL debug message callback
authorMatthias Clasen <mclasen@redhat.com>
Tue, 6 Oct 2020 13:25:47 +0000 (09:25 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 6 Oct 2020 14:34:30 +0000 (10:34 -0400)
Go back to installing our debug message callback
unconditionally if G_ENABLE_CONSISTENCY_CHECKS is
defined, and allow opting into it using GDK_DEBUG=gl-debug
otherwise.

gdk/gdkglcontext.c

index 01c67688f2d1a521cbcbe923ea669dbc8ba75fc8..135db3014014356584d71d68319160c46b5b773a 100644 (file)
@@ -864,7 +864,6 @@ gdk_gl_context_get_use_es (GdkGLContext *context)
   return priv->use_es > 0;
 }
 
-#ifdef G_ENABLE_DEBUG
 static void
 gl_debug_message_callback (GLenum        source,
                            GLenum        type,
@@ -955,7 +954,6 @@ gl_debug_message_callback (GLenum        source,
   g_warning ("OPENGL:\n    Source: %s\n    Type: %s\n    Severity: %s\n    Message: %s",
              message_source, message_type, message_severity, message);
 }
-#endif
 
 /**
  * gdk_gl_context_realize:
@@ -1011,15 +1009,19 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
 #ifdef G_ENABLE_DEBUG
   display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
   gl_debug = GDK_DISPLAY_DEBUG_CHECK (display, GL_DEBUG);
+#endif
 
-  if (priv->has_debug_output && gl_debug)
+  if (priv->has_debug_output
+#ifndef G_ENABLE_CONSISTENCY_CHECKS
+      && gl_debug
+#endif
+      )
     {
       gdk_gl_context_make_current (context);
       glEnable (GL_DEBUG_OUTPUT);
       glEnable (GL_DEBUG_OUTPUT_SYNCHRONOUS);
       glDebugMessageCallback (gl_debug_message_callback, NULL);
     }
-#endif
 
   if (priv->use_es)
     {